package com.agrm.order.service;

import com.agrm.model.order.dto.OrderPay;
import com.agrm.model.order.dto.OrderSubmit;
import com.agrm.model.order.pojo.Order;
import com.agrm.model.order.search.OrderSearchBean;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;

public interface OrderService extends IService<Order> {

    /**
     * 提交订单
      * @param orderSubmit
     * @return
     */
    int submitOrder(OrderSubmit orderSubmit);
    /**
     * 提交秒杀订单
      * @param orderSubmit
     * @return
     */
    boolean saveForSeckill(OrderSubmit orderSubmit);


    /**
     * 支付订单
     * @param orderPay
     * @return
     */
    int payOrder(OrderPay orderPay);


    /**
     * 取消订单
     * @param orderNo
     * @return
     */
    int cancelOrder(String orderNo);


    /**
     * 删除订单
     * @param ids
     * @return
     */
    int deleteByIds(List<Integer> ids);


    Page<Order> findAll(OrderSearchBean osb, Page<Order> page);

    //查询唯一订单
    Order findById(Integer id);

    //订单编号
    Order findByOrderNo(String orderNo);

    //保存订单
//    boolean save(Order order);

    //修改订单
    boolean update(Order order);

    //发货
    boolean updateForShip(Integer orderId);

    //确认收货
    boolean updateForAccept(Integer orderId);

    /**
     * 批量删除订单
     *
     * @param ids   订单编号
     * @param logic 是否逻辑删除
     * @return 删除的行数
     */
    int deleteByIds(List<Integer> ids, boolean logic);
}
